#include<cstdio>
#include<cstring>
using namespace std;
const int N = 405;
int n, a[N], p[N], b[N], q[N], cnt = 0, arc[N][N], visited[N], match[N];

bool dfs(int u){
	for(int v=1;v<=n;v++){
		if(!visited[v] && arc[u][v]){
			visited[v] = 1;
			if(match[v] == 0 || dfs(match[v])){
				match[v] = u;
				return true;
			}
		}
	}
	return false;
}

int main(){
	scanf("%d", &n);
	for(int i=1;i<=n;i++){
		scanf("%d", &a[i]);
	}
	for(int i=1;i<=n;i++){
		scanf("%d", &p[i]);
	}
	for(int i=1;i<=n;i++){
		scanf("%d", &b[i]);
	}
	for(int i=1;i<=n;i++){
		scanf("%d", &q[i]);
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(b[j] >= p[i] && a[i] >= q[j]){
				arc[i][j] = 1;
			}
		}
	}
	
	for(int i=1;i<=n;i++){
		memset(visited, 0, sizeof visited);
		if(dfs(i)){
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}
